import { http } from '/@/utils/http';

import type {
  ArticlePageParams,
  ArticlePageResult,
  SpColumnPageParams,
  SpColumnPageResult,
  ColumnListParams,
  ColumnListResult,
  ArticleCommentListParams,
  ArticleCommentListResult,
} from './model/articleModel';

export function queryArticleCommentsList(params: ArticleCommentListParams) {
  return http.post<ArticleCommentListResult>({
    url: '/api/app/article/comments/list',
    params: {
      ...params,
      type: 1,
    },
  });
}

/**
 * 获取文章已发布分页
 * @param params ArticlePageParams
 * @returns ArticlePageResult
 */
export function queryAppPublishedArticlePage(params: ArticlePageParams) {
  return http.post<ArticlePageResult>({
    url: '/api/app/article/article/page',
    params,
  });
}

/**
 * 获取专栏列表
 * @param SpColumnListParams
 * @returns SpColumnPageResult
 */
export function queryAppSpColumnPage(params: SpColumnPageParams) {
  return http.post<SpColumnPageResult>({
    url: '/api/app/article/sp_column/page',
    params,
  });
}

/**
 * 获取栏目列表
 * @param ColumnListParams
 * @returns ColumnListResult
 */
export function queryAppColumnList(params: ColumnListParams) {
  return http.post<ColumnListResult>({
    url: '/api/app/article/column/list',
    params,
  });
}
